package com.yxq.mdt.app.modules.personal.model;

import com.yxq.mdt.app.base.ibase.IBaseModel;
import com.yxq.mdt.app.modules.personal.bean.PrivateSetResultBean;
import com.yxq.mdt.app.net.ApiModel;
import com.yxq.mdt.app.net.BaseObserver;
import com.yxq.mdt.app.net.RetrofitFactory;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * @author L
 * @time 2019-11-25
 * @describe 我的-设置$
 */
public class SettingModel implements IBaseModel {

    public void updateGaUserExtShowInfo(String showInfo, ApiModel.CommonCallback<PrivateSetResultBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(SettingAPI.class)
                .updateGaUserExtShowInfo(showInfo)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseObserver<PrivateSetResultBean>() {
                    @Override
                    public void onFailure(Throwable e, boolean isNetWorkError) {
                        callback.onError(e.getMessage());
                    }

                    @Override
                    public void onSuccess(PrivateSetResultBean respBase) {
                        callback.onSuccess(respBase);
                    }
                });
    }

    @Override
    public void onDestroy() {

    }
}
